import { Sequelize } from "sequelize";


export const sequelize = new Sequelize('soft2','root','123456',
    {
        dialect:'mysql',
        host: 'localhost'
    }
)

export const sync = async() => {
    let { Book } = await import('../model/Book.js')
    await sequelize.sync({force:true})
    let arr = [
        {
            id:1,
            bookName:'最强大脑',
            bookAuthor:'蒲熠星',
          },
          {
            id:2,
            bookName:'07快男全国总冠军',
            bookAuthor:'陈楚生',
          },
          {
            id:3,
            bookName:'07快男西安冠军',
            bookAuthor:'苏醒',
          },
          {
            id:4,
            bookName:'07快男广州冠军',
            bookAuthor:'王栎鑫',
          },
          {
            id:5,
            bookName:'07快男南京冠军',
            bookAuthor:'张远',
          },
          {
            id:6,
            bookName:'95世界手风琴冠军',
            bookAuthor:'王铮亮',
          },
          {
            id:7,
            bookName:'07快男长沙冠军',
            bookAuthor:'陆虎',
          }
    ]
    await Book.bulkCreate(arr)
}